/*
 * Copyright 2006 Matt Jensen
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package org.spectaql.internal.proxy;

import org.spectaql.metadata.PropertyMetadata;

/**
 * <p>
 * <code>ProxyInternal</code> is the base interface which must be extended by the internal interface for any proxy
 * object. It is primarily used by the property accessor callback to notify the instance handler of invocations of
 * entity property getter and setter methods. The handler can use this information in whatever way is necessary
 * dependent upon the specific proxy type.
 * </p>
 */
public interface ProxyInternal
{
    /**
     * <p>
     * Handle an invocation of an entity property getter method.
     * </p>
     *
     * @param propertyMetadata metadata for the property which was read.
     * @return {@link Object} to return from the invocation.
     */
    Object handlePropertyRead(PropertyMetadata propertyMetadata);

    /**
     * <p>
     * Handle an invocation of an entity property setter method.
     * </p>
     *
     * @param propertyMetadata metadata for the property which was written.
     * @param value the value written to the property.
     */
    void handlePropertyWrite(PropertyMetadata propertyMetadata, Object value);
}
